// 统一使用 @tuxing/core-token 包
import { getToken as getCoreToken, setToken as setCoreToken, clearTokens } from '@tuxing/core-token';

export function getToken(): string | undefined {
  const token = getCoreToken();
  // 如果没有token，也尝试从localStorage读取
  if (!token) {
    return localStorage.getItem('token') || undefined;
  }
  return token;
}

export function setToken(token: string, userInfo?: any): void {
  setCoreToken(token, userInfo);
}

export function removeToken(): void {
  clearTokens();
}
